#ifndef PLAYER_H
#define PLAYER_H

#include "MainWindow.h"
#include "Audio.h"
#include <QtGui>
#include "Track.h"
#include "PlaylistTab.h"
#include "TableModel.h"
#include "MusicList.h"

class Player: public QObject
{
	Q_OBJECT
	public:
		Player(int, char*[]);
		int launch();
		
	public slots:
		void onActionPlayTriggered();
		void onActionStopTriggered();
		void onMediaObjectStateChanged(Phonon::State, Phonon::State);
		void onActionOpenFilesTriggered();
		void onMediaObjectFinished();
		void onMediaObjectAboutToFinish();
		void onTabWidgetCurrentChanged(int index);
		void onActionFirstTriggered();
		void onActionPreviousTriggered();
		void onActionNextTriggered();
		void onActionLastTriggered();
		void onCurrentTabDoubleClicked(const QModelIndex &index);
		void onActionRepeatToggled(bool checked);
		void onActionRandomToggled(bool checked);
		void onActionOpenPlaylistTriggered();
		void onActionNewPlaylistTriggered();
		void onActionSavePlaylistTriggered();
		void onMediaObjectTotalTimeChanged(qint64 time);
		void onMediaObjectTick(qint64 time);
		void onTabWidgetTabCloseRequested(int);
		void onMediaObjectCurrentSourceChanged(const Phonon::MediaSource source);
		void onLineEditSearchTextEdited(const QString& text);
		void onActionQuitTriggered();
		void onCurrentTabClicked(const QModelIndex & index);

	private:
		Audio* audio;
		MainWindow* mainWindow;
		QStringList playList;
		int it;
		void connectComponents();
		PlaylistTab* currentTab;
		MusicList* currentList;
		QApplication app;
		
		
};

#endif
